package com.hongyue.kafka.listener;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.Optional;

@Component
public class HelloListener {

    private static final String TOPIC = "out_topic";

    @KafkaListener(topics = TOPIC)
    public void receiverMessage(ConsumerRecord<String, String> record) {
        System.out.println(record.key() + ":" + record.value());
    }
}